package com.lcq.example.mybatis.demo.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lcq.example.mybatis.demo.entity.UserPo;
import com.lcq.example.mybatis.demo.mapper.UserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @ClassName UserServcieImpl
 * @Description
 * @Author lichuanqi
 * @Date 2021/11/10 15:32
 * @Version 1.0
 **/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, UserPo> {
    @Resource
    private UserMapper userMapper;

    @Transactional()
    public void testTransaction(){
        UserPo userPo = new UserPo();
        userPo.setId("testuserid111");
        userPo.setAge(10);
        userPo.setEmail("111@163.com");
        userPo.setName("张三");
        userMapper.insert(userPo);
        int i = 1/0;
        System.out.println(i);
    }
}
